<!DOCTYPE html>
<html lang="en">


<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue-core</title>

</head>

<body>
    <div id="app">
        <h3>javascript实现vue核心功能MVVM，深入响应式原理</h3>
        <input type="text" v-model="school.name">
        <div>双向绑定input: {{school.name}}</div>
        <div>插入一个data属性值: {{school.age}}</div>
        {{getNewName}}
        <ul>
            <li>1</li>
            <li>2</li>
        </ul>
        <button v-on:click="change">更新</button>
        <div>
            下面是一个 v-html 指令
            <div v-html="msg"></div>
        </div>
    </div>
    <!-- <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script> -->
    <script src="./core/watcher.js"></script>
    <script src="./core/observer.js"></script>
    <script src="./core/compile.js"></script>
    <script src="./core/MVVM.js"></script>
    <!-- <script src="./core/index.js"></script> -->
    <script>
        let vm = new Vue({
            el: '#app',
            data: {
                school: {
                    name: "社会",
                    age: 18
                },
                name: "xiao",
                msg: '<h1>hello world</h1>'
            },
            computed: {
                getNewName() {
                    return `这是一个computed属性(getNewName): ${this.school.name} xixi`
                }
            },
            methods: {
                change() {
                    this.school.name = "test"
                }
            }
        })
    </script>
</body>

</html>